const { DataTypes, Sequelize } = require("sequelize");
const sequelize = require("./sequelizeBaseConfig.js");

const TagVO = sequelize.define(
  "Tag",
  {
    id: {
      type: DataTypes.BIGINT,
      comment: "ID",
      autoIncrement: true, //自增
      primaryKey: true, //主键
    },
    created_at: {
      type: DataTypes.DATE,
      allowNull: true,
      comment: "创建时间",
      defaultValue: Sequelize.literal("CURRENT_TIMESTAMP"), //如果没有设置该字段的值则使用默认
    },
    updated_at: {
      type: DataTypes.DATE,
      allowNull: true,
      comment: "更新时间",
      defaultValue: Sequelize.literal(
        "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"
      ),
    },
    name: {
      type: DataTypes.STRING(100),
      allowNull: false,
      comment: "标签名",
    },
  },
  {
    tableName: "tag",
    timestamps: false,
  }
);

module.exports = { TagVO };
